#pragma once

#include "DebuggerInterface.h"

namespace DebuggerTest {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for DebuggerTestForm
	/// </summary>
	public ref class DebuggerTestForm : public System::Windows::Forms::Form
	{
	public:
		DebuggerTestForm(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~DebuggerTestForm()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::TableLayoutPanel^  tableLayoutPanel;
	protected: 
	private: System::Windows::Forms::Button^  buttonShowDLLForm;
	private: System::Windows::Forms::Button^  buttonAddLineToLog;
	private: System::Windows::Forms::Button^  buttonAddLineToLogGroup2;
	private: System::Windows::Forms::Button^  buttonExitUDK;
	private: System::Windows::Forms::Button^  buttonAddLineToLogGroup1;
	private: System::Windows::Forms::Button^  buttonUpdateCallstack;
	private: System::Windows::Forms::Button^  buttonUpdateWatches;
	private: System::Windows::Forms::Button^  button1;
	private: System::Windows::Forms::Button^  button2;
	private: System::Windows::Forms::Button^  button3;
	private: System::Windows::Forms::Button^  buttonLoadClass;


	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->tableLayoutPanel = (gcnew System::Windows::Forms::TableLayoutPanel());
			this->buttonAddLineToLogGroup2 = (gcnew System::Windows::Forms::Button());
			this->buttonShowDLLForm = (gcnew System::Windows::Forms::Button());
			this->buttonAddLineToLog = (gcnew System::Windows::Forms::Button());
			this->buttonExitUDK = (gcnew System::Windows::Forms::Button());
			this->buttonAddLineToLogGroup1 = (gcnew System::Windows::Forms::Button());
			this->buttonUpdateCallstack = (gcnew System::Windows::Forms::Button());
			this->buttonUpdateWatches = (gcnew System::Windows::Forms::Button());
			this->button1 = (gcnew System::Windows::Forms::Button());
			this->button2 = (gcnew System::Windows::Forms::Button());
			this->button3 = (gcnew System::Windows::Forms::Button());
			this->buttonLoadClass = (gcnew System::Windows::Forms::Button());
			this->tableLayoutPanel->SuspendLayout();
			this->SuspendLayout();
			// 
			// tableLayoutPanel
			// 
			this->tableLayoutPanel->ColumnCount = 1;
			this->tableLayoutPanel->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent, 
				100)));
			this->tableLayoutPanel->Controls->Add(this->buttonAddLineToLogGroup2, 0, 3);
			this->tableLayoutPanel->Controls->Add(this->buttonShowDLLForm, 0, 0);
			this->tableLayoutPanel->Controls->Add(this->buttonAddLineToLog, 0, 1);
			this->tableLayoutPanel->Controls->Add(this->buttonAddLineToLogGroup1, 0, 2);
			this->tableLayoutPanel->Controls->Add(this->buttonUpdateCallstack, 0, 4);
			this->tableLayoutPanel->Controls->Add(this->buttonUpdateWatches, 0, 5);
			this->tableLayoutPanel->Controls->Add(this->buttonExitUDK, 0, 10);
			this->tableLayoutPanel->Controls->Add(this->button1, 0, 9);
			this->tableLayoutPanel->Controls->Add(this->button2, 0, 8);
			this->tableLayoutPanel->Controls->Add(this->button3, 0, 7);
			this->tableLayoutPanel->Controls->Add(this->buttonLoadClass, 0, 6);
			this->tableLayoutPanel->Dock = System::Windows::Forms::DockStyle::Fill;
			this->tableLayoutPanel->Location = System::Drawing::Point(0, 0);
			this->tableLayoutPanel->Name = L"tableLayoutPanel";
			this->tableLayoutPanel->RowCount = 12;
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 50)));
			this->tableLayoutPanel->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Absolute, 20)));
			this->tableLayoutPanel->Size = System::Drawing::Size(408, 602);
			this->tableLayoutPanel->TabIndex = 1;
			// 
			// buttonAddLineToLogGroup2
			// 
			this->buttonAddLineToLogGroup2->Dock = System::Windows::Forms::DockStyle::Fill;
			this->buttonAddLineToLogGroup2->Location = System::Drawing::Point(3, 153);
			this->buttonAddLineToLogGroup2->Name = L"buttonAddLineToLogGroup2";
			this->buttonAddLineToLogGroup2->Size = System::Drawing::Size(402, 44);
			this->buttonAddLineToLogGroup2->TabIndex = 7;
			this->buttonAddLineToLogGroup2->Text = L"Add Line To Log (Group 2)";
			this->buttonAddLineToLogGroup2->UseVisualStyleBackColor = true;
			this->buttonAddLineToLogGroup2->Click += gcnew System::EventHandler(this, &DebuggerTestForm::buttonAddLineToLogGroup2_Click);
			// 
			// buttonShowDLLForm
			// 
			this->buttonShowDLLForm->Dock = System::Windows::Forms::DockStyle::Fill;
			this->buttonShowDLLForm->Location = System::Drawing::Point(3, 3);
			this->buttonShowDLLForm->Name = L"buttonShowDLLForm";
			this->buttonShowDLLForm->Size = System::Drawing::Size(402, 44);
			this->buttonShowDLLForm->TabIndex = 0;
			this->buttonShowDLLForm->Text = L"Show DLL Form";
			this->buttonShowDLLForm->UseVisualStyleBackColor = true;
			this->buttonShowDLLForm->Click += gcnew System::EventHandler(this, &DebuggerTestForm::buttonShowDLLForm_Click);
			// 
			// buttonAddLineToLog
			// 
			this->buttonAddLineToLog->Dock = System::Windows::Forms::DockStyle::Fill;
			this->buttonAddLineToLog->Location = System::Drawing::Point(3, 53);
			this->buttonAddLineToLog->Name = L"buttonAddLineToLog";
			this->buttonAddLineToLog->Size = System::Drawing::Size(402, 44);
			this->buttonAddLineToLog->TabIndex = 1;
			this->buttonAddLineToLog->Text = L"Add Line To Log";
			this->buttonAddLineToLog->UseVisualStyleBackColor = true;
			this->buttonAddLineToLog->Click += gcnew System::EventHandler(this, &DebuggerTestForm::buttonAddLineToLog_Click);
			// 
			// buttonExitUDK
			// 
			this->buttonExitUDK->Dock = System::Windows::Forms::DockStyle::Fill;
			this->buttonExitUDK->Location = System::Drawing::Point(3, 503);
			this->buttonExitUDK->Name = L"buttonExitUDK";
			this->buttonExitUDK->Size = System::Drawing::Size(402, 44);
			this->buttonExitUDK->TabIndex = 5;
			this->buttonExitUDK->Text = L"Exit UDK";
			this->buttonExitUDK->UseVisualStyleBackColor = true;
			// 
			// buttonAddLineToLogGroup1
			// 
			this->buttonAddLineToLogGroup1->Dock = System::Windows::Forms::DockStyle::Fill;
			this->buttonAddLineToLogGroup1->Location = System::Drawing::Point(3, 103);
			this->buttonAddLineToLogGroup1->Name = L"buttonAddLineToLogGroup1";
			this->buttonAddLineToLogGroup1->Size = System::Drawing::Size(402, 44);
			this->buttonAddLineToLogGroup1->TabIndex = 6;
			this->buttonAddLineToLogGroup1->Text = L"Add Line To Log (Group 1)";
			this->buttonAddLineToLogGroup1->UseVisualStyleBackColor = true;
			this->buttonAddLineToLogGroup1->Click += gcnew System::EventHandler(this, &DebuggerTestForm::buttonAddLineToLogGroup1_Click);
			// 
			// buttonUpdateCallstack
			// 
			this->buttonUpdateCallstack->Dock = System::Windows::Forms::DockStyle::Fill;
			this->buttonUpdateCallstack->Location = System::Drawing::Point(3, 203);
			this->buttonUpdateCallstack->Name = L"buttonUpdateCallstack";
			this->buttonUpdateCallstack->Size = System::Drawing::Size(402, 44);
			this->buttonUpdateCallstack->TabIndex = 8;
			this->buttonUpdateCallstack->Text = L"Update Callstack";
			this->buttonUpdateCallstack->UseVisualStyleBackColor = true;
			this->buttonUpdateCallstack->Click += gcnew System::EventHandler(this, &DebuggerTestForm::buttonUpdateCallstack_Click);
			// 
			// buttonUpdateWatches
			// 
			this->buttonUpdateWatches->Dock = System::Windows::Forms::DockStyle::Fill;
			this->buttonUpdateWatches->Location = System::Drawing::Point(3, 253);
			this->buttonUpdateWatches->Name = L"buttonUpdateWatches";
			this->buttonUpdateWatches->Size = System::Drawing::Size(402, 44);
			this->buttonUpdateWatches->TabIndex = 9;
			this->buttonUpdateWatches->Text = L"Update Watches";
			this->buttonUpdateWatches->UseVisualStyleBackColor = true;
			this->buttonUpdateWatches->Click += gcnew System::EventHandler(this, &DebuggerTestForm::buttonUpdateWatches_Click);
			// 
			// button1
			// 
			this->button1->Dock = System::Windows::Forms::DockStyle::Fill;
			this->button1->Location = System::Drawing::Point(3, 453);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(402, 44);
			this->button1->TabIndex = 10;
			this->button1->Text = L"<Empty>";
			this->button1->UseVisualStyleBackColor = true;
			// 
			// button2
			// 
			this->button2->Dock = System::Windows::Forms::DockStyle::Fill;
			this->button2->Location = System::Drawing::Point(3, 403);
			this->button2->Name = L"button2";
			this->button2->Size = System::Drawing::Size(402, 44);
			this->button2->TabIndex = 11;
			this->button2->Text = L"<Empty>";
			this->button2->UseVisualStyleBackColor = true;
			// 
			// button3
			// 
			this->button3->Dock = System::Windows::Forms::DockStyle::Fill;
			this->button3->Location = System::Drawing::Point(3, 353);
			this->button3->Name = L"button3";
			this->button3->Size = System::Drawing::Size(402, 44);
			this->button3->TabIndex = 12;
			this->button3->Text = L"<Empty>";
			this->button3->UseVisualStyleBackColor = true;
			// 
			// buttonLoadClass
			// 
			this->buttonLoadClass->Dock = System::Windows::Forms::DockStyle::Fill;
			this->buttonLoadClass->Location = System::Drawing::Point(3, 303);
			this->buttonLoadClass->Name = L"buttonLoadClass";
			this->buttonLoadClass->Size = System::Drawing::Size(402, 44);
			this->buttonLoadClass->TabIndex = 13;
			this->buttonLoadClass->Text = L"Load Class";
			this->buttonLoadClass->UseVisualStyleBackColor = true;
			this->buttonLoadClass->Click += gcnew System::EventHandler(this, &DebuggerTestForm::buttonLoadClass_Click);
			// 
			// DebuggerTestForm
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(408, 602);
			this->Controls->Add(this->tableLayoutPanel);
			this->Name = L"DebuggerTestForm";
			this->Text = L"UDK Sim";
			this->tableLayoutPanel->ResumeLayout(false);
			this->ResumeLayout(false);

		}
#pragma endregion
	
	private: System::Void buttonShowDLLForm_Click(System::Object^  sender, System::EventArgs^  e) 
			 {
				SetCallback(nullptr);
				ShowDllForm();
			 }

	private: System::Void buttonAddLineToLog_Click(System::Object^  sender, System::EventArgs^  e) 
			 {
				 AddLineToLog("Log: UDK log");
			 }

	private: System::Void buttonAddLineToLogGroup1_Click(System::Object^  sender, System::EventArgs^  e)
			 {
				 AddLineToLog("Group1: UDK log");
			 }

	private: System::Void buttonAddLineToLogGroup2_Click(System::Object^  sender, System::EventArgs^  e) 
			 {
				 AddLineToLog("Group2: UDK log");
			 }

	private: System::Void buttonExitUDK_Click(System::Object^  sender, System::EventArgs^  e) 
			 {
				 AddLineToLog("Exit: Preparing to exit.");
			 }

	private: System::Void buttonUpdateCallstack_Click(System::Object^  sender, System::EventArgs^  e) 
			 {
				 CallStackClear();
				 CallStackAdd("Function A (0x1234)");
				 CallStackAdd("Function B (0xfafa)");
			 }

	private: System::Void buttonUpdateWatches_Click(System::Object^  sender, System::EventArgs^  e) 
			 {
				 LockList(0);
				 LockList(1);
				 LockList(2);

				 ClearAWatch(0);
				 int parent0 = AddAWatch(0, 0, "!TestVec","");
				 AddAWatch(0, parent0, "X (Float, 1, 1)", "10");
				 AddAWatch(0, parent0, "Y (Bool, 1, 1)", "20");
				 AddAWatch(0, parent0, "Z (Int, 1, 1)", "30");

				 ClearAWatch(1);
				 int parent1 = AddAWatch(1, 0, "!TestVec","");
				 AddAWatch(1, parent1, "X", "10");
				 AddAWatch(1, parent1, "Y", "20");
				 AddAWatch(1, parent1, "Z", "30");

				 ClearAWatch(2);
				 int parent2 = AddAWatch(2, 0, "!TestVec","");
				 AddAWatch(2, parent2, "X", "10");
				 AddAWatch(2, parent2, "Y", "20");
				 AddAWatch(2, parent2, "Z", "30");

				 UnlockList(0);
				 UnlockList(1);
				 UnlockList(2);
			 }

	private: System::Void buttonLoadClass_Click(System::Object^  sender, System::EventArgs^  e) 
			 {
				 static int line = 100;

				 EditorLoadClass("Engine.PlayerInput");
				 EditorGotoLine(line++, 1);
			 }
};
}

